package com.region.spring.boot;

import com.region.common.adapter.json.JSONAdapter;
import com.region.common.adapter.logging.LoggerAdapter;
import com.region.http.client.config.GlobalRequestConfig;
import com.region.loadbalancer.LoadBalancerConfig;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

/**
 * @author liujieyu
 * @date 2024/7/17 20:12
 * @desciption
 */
@Component
@ConfigurationProperties(prefix = "region.client")
public class RegionAdapterProperties {

    private boolean enabled = true;

    /**
     * The scanning packages
     */
    private String[] basePackages;

    /**
     * Set Logger framework Adapter
     */
    private Class<? extends LoggerAdapter> loggerAdapter;

    /**
     * Set Json framework adapter
     */
    private Class<? extends JSONAdapter> jsonAdapter;

    /**
     * The load balancer config
     */
    private LoadBalancerConfig balancerConfig;

    /**
     * default global request config
     */
    private GlobalRequestConfig global;

    /**
     * The Temp Cache Path
     */
    private String cachePath = System.getProperty("java.io.tmpdir");

    /**
     * Automatically monitors the load balancer
     */
    private boolean autoMonitor = true;

    public boolean isEnabled() {
        return enabled;
    }

    public void setEnabled(boolean enabled) {
        this.enabled = enabled;
    }

    public String[] getBasePackages() {
        return basePackages;
    }

    public void setBasePackages(String[] basePackages) {
        this.basePackages = basePackages;
    }

    public Class<? extends LoggerAdapter> getLoggerAdapter() {
        return loggerAdapter;
    }

    public void setLoggerAdapter(Class<? extends LoggerAdapter> loggerAdapter) {
        this.loggerAdapter = loggerAdapter;
    }

    public Class<? extends JSONAdapter> getJsonAdapter() {
        return jsonAdapter;
    }

    public void setJsonAdapter(Class<? extends JSONAdapter> jsonAdapter) {
        this.jsonAdapter = jsonAdapter;
    }

    public LoadBalancerConfig getBalancerConfig() {
        return balancerConfig;
    }

    public void setBalancerConfig(LoadBalancerConfig balancerConfig) {
        this.balancerConfig = balancerConfig;
    }

    public GlobalRequestConfig getGlobal() {
        return global;
    }

    public void setGlobal(GlobalRequestConfig global) {
        this.global = global;
    }

    public String getCachePath() {
        return cachePath;
    }

    public void setCachePath(String cachePath) {
        this.cachePath = cachePath;
    }

    public boolean isAutoMonitor() {
        return autoMonitor;
    }

    public void setAutoMonitor(boolean autoMonitor) {
        this.autoMonitor = autoMonitor;
    }

}
